import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

class CommonUtil {
  static bool debounceEnable = true;

  static void textInputHide() {
    SystemChannels.textInput.invokeMethod('TextInput.hide');
  }

  static Function debounce(Function func, Duration? delay) {
    return () {
      if (debounceEnable) {
        func();
        debounceEnable = false;
        Future.delayed(delay ?? const Duration(milliseconds: 666), () {
          debounceEnable = true;
        });
      }
    };
  }

  static double getAppHeaderTop(BuildContext context){
    return  MediaQuery.of(context).padding.top + 5;
  }


}